﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VisionCore
{
    public class HoldHelper
    {
        /// <summary>
        /// 关闭时调用，将数据保存
        /// </summary>
        public void SavePara()
        {
            try
            {
                HoldDAL.Save(ParameterHelper.SysParam.LifeTime.Clamp.Insp1_RM_Z_UsedCount, "检测模组1-Z轴力控使用次数");
                HoldDAL.Save(ParameterHelper.SysParam.LifeTime.Clamp.Insp2_RM_Z_UsedCount, "检测模组2-Z轴力控使用次数");
                HoldDAL.Save(ParameterHelper.SysParam.LifeTime.Clamp.Insp3_RM_Z_UsedCount, "检测模组3-Z轴力控使用次数");
                HoldDAL.Save(ParameterHelper.SysParam.LifeTime.Clamp.Insp4_RM_Z_UsedCount, "检测模组4-Z轴力控使用次数");
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// 开启程序时调用，加载数据
        /// </summary>
        public void LoadPara()
        {
            try
            {
                ParameterHelper.SysParam.LifeTime.Clamp.Insp1_RM_Z_UsedCount = HoldDAL.Load(ParameterHelper.SysParam.LifeTime.Clamp.Insp1_RM_Z_UsedCount, "检测模组1-Z轴力控使用次数");
                ParameterHelper.SysParam.LifeTime.Clamp.Insp2_RM_Z_UsedCount = HoldDAL.Load(ParameterHelper.SysParam.LifeTime.Clamp.Insp2_RM_Z_UsedCount, "检测模组2-Z轴力控使用次数");
                ParameterHelper.SysParam.LifeTime.Clamp.Insp3_RM_Z_UsedCount = HoldDAL.Load(ParameterHelper.SysParam.LifeTime.Clamp.Insp3_RM_Z_UsedCount, "检测模组3-Z轴力控使用次数");
                ParameterHelper.SysParam.LifeTime.Clamp.Insp4_RM_Z_UsedCount = HoldDAL.Load(ParameterHelper.SysParam.LifeTime.Clamp.Insp4_RM_Z_UsedCount, "检测模组4-Z轴力控使用次数");              
                Kernel.Exc.DO.Y058_SafeDoor1_Lock = HoldDAL.Load(Kernel.Exc.DO.Y058_SafeDoor1_Lock, "门锁1");
                Kernel.Exc.DO.Y059_SafeDoor2_Lock = HoldDAL.Load(Kernel.Exc.DO.Y059_SafeDoor2_Lock, "门锁2");
                //ProcedureHelper_EQ.Light_Open = HoldDAL.Load(ProcedureHelper_EQ.Light_Open, "灯1");
                //Kernel.Efem.DO.Y1B8_LightOpen = HoldDAL.Load(Kernel.Efem.DO.Y1B8_LightOpen, "灯2");
                //Kernel.Insp.DO.Y19F_Lihgt_Open = HoldDAL.Load(Kernel.Insp.DO.Y19F_Lihgt_Open, "灯3");
                ParameterHelper.SysParam.CurPRM = HoldDAL.Load(ParameterHelper.SysParam.CurPRM, "当前工单");
            }
            catch (Exception)
            {

            }
        }

    }
}
